package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File dir=new File("./src/list");
        File[] subs=dir.listFiles();
        System.out.println("当前目录子项个数:"+subs.length);
        for (File sub: subs){
            System.out.println(sub.getName());

        File file1=new File("./src/list/ListDemo.java");
        if (file1.isFile()){
            System.out.println("是文件，已存在");
        }else {
            System.out.println("不是文件或不存在");
        }

    }
}
}
